using System.Collections;
using FlowCanvas;
using FlowCanvas.Nodes;
using NodeCanvas.Framework;
using ParadoxNotion.Design;
using UnityEngine;
using Yoozoo.Gameplay.Liberty.AI;
using Yoozoo.Gameplay.Liberty.PlayerController;

namespace Yoozoo.Gameplay.Liberty.Nodes
{
    [Category("Ggame")][Description("pointName为空时，走position，forward变量")]
    public class SetPlayerDestination : CallableActionNode<string,Vector3,NavType>
    {
        public override void Invoke(string pointName, Vector3 position,NavType navType)
        {
            pointName = pointName.Trim();
            Vector3 destination = Vector3.zero;

            if (string.IsNullOrEmpty(pointName))
            {
                destination = position;
            }
            else
            {
                var point = BlueprintUtils.GetBlueprintPoint(pointName);
                if (point!=null) {
                    destination = point.position;
                }
            }

            BlueprintUtils.SetPlayerDestination(destination, navType);
        }
    }
}